import 'package:flutter/material.dart';

class AllDrawableTextWidget2 extends StatelessWidget {
  Widget title;
  GestureTapCallback callback;
  double paddingLeft;
  double paddingTop;
  double paddingRight;
  double paddingBottom;
  Widget iconLeft;
  Widget iconTop;
  Widget iconRight;
  Widget iconBottom;
  List<Widget> _listParent = [];

  List<Widget> _listChild = [];

  AllDrawableTextWidget2(
      {Key key,
      @required this.title,
      this.callback,
      this.paddingLeft = 0,
      this.paddingTop = 0,
      this.paddingRight = 0,
      this.paddingBottom = 0,
      this.iconLeft,
      this.iconTop,
      this.iconRight,
      this.iconBottom});

  Widget getWidget() {
    return Column(children: _listParent);
  }

  Widget getOffstage() {
    return Offstage(
      offstage: true,
      child: null,
    );
  }

  @override
  Widget build(BuildContext context) {
    iconLeft = iconLeft ?? getOffstage();
    iconRight = iconRight ?? getOffstage();
    iconBottom = iconBottom??getOffstage();
    iconTop = iconTop??getOffstage();

    return GestureDetector(
      onTap: callback,
      child: Container(
          child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          iconTop,
          Padding(padding: EdgeInsets.only(top: paddingTop)),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              iconLeft,
              Padding(padding: EdgeInsets.only(left: paddingLeft)),
              title,
              Padding(padding: EdgeInsets.only(right: paddingRight)),
              iconRight,
            ],
          ),
          Padding(padding: EdgeInsets.only(bottom: paddingBottom)),
          iconBottom
        ],
      )),
    );
  }
}
